package 设计模式.工厂模式;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

/**
 * @author 孔令富  2021/10/22
 */
public class BeanFactoryTest {

    public static void main(String[] args) {

        Resource resource = new ClassPathResource("spring-factory.xml");
         BeanFactory  beanFactory  = new XmlBeanFactory(resource);
        Car car = (Car) beanFactory.getBean("car");
        car.show();;

    }
}
